n = int(input())
k = int(input())
c = [0] * 1001
for _ in range(n):
    c[int(input())] += 1

ans_pairs = ans_sum = 0
rest = False
rest_pos = -1
for i in range(1000, 0, -1):
    if c[i] == 0:
        continue  
    if rest:
        rest = False
        if rest_pos - i <= k:
           c[i] -= 1
           ans_pairs += 1
        else:
           ans_sum += rest_pos 
    ans_pairs += c[i] // 2
    if c[i] % 2 != 0:
        rest_pos = i
        rest = True
if rest:
    ans_sum += rest_pos 
print(ans_pairs, ans_sum, sep='\n')
